import request from '@/utils/request'

export default {
  getWagesList(searchModel) {
    return request({
      url: '/wages/list',
      method: 'get',
      params: {
        page: searchModel.page,
        pageSize: searchModel.pageSize,
        name: searchModel.name
      }
    })
  },
  addWages(wages) {
    return request({
      url: '/wages',
      method: 'post',
      data: wages
    })
  },
  getWagesById(id) {
    return request({
      // url: '/wages/' + id,
      url: `/wages/${id}`,
      method: 'get'
    })
  },
  updateWages(wages) {
    return request({
      url: '/wages',
      method: 'put',
      data: wages
    })
  },
  saveWages(wages) {
    if (wages.id == null && wages.id === undefined) {
      return this.addWages(wages)
    }
    return this.updateWages(wages)
  },
  deleteWages(id) {
    return request({
      // url: '/user/' + id,
      url: `/wages/${id}`,
      method: 'delete'
    })
  },
  getUserName(params) {
    return request({
      url: '/user/name',
      method: 'get',
      params
    })
  },
  updateWagesById(params) {
    return request({
      url: '/wages/status',
      method: 'put',
      data: params
    })
  }
}
